*. Sticky notes


Free plug: SEKAS (68k assembler) by Twilight Translations. Not available yet.

; -------------------------------------------------------------------------------------

Game uses standard Sega compression libraries - Nemesis (bitmaps) and Enigma (nametables).
KENS group provided source code and they are fantastic (stronger than Sega). You should
take note of the actual decompression assembly for future reference.

Title screen = Nemesis bitmap. See unpacking files.

There are some missing kanji from the font table that need filling (compressed).
Spaces are replaced with '@@' for visual padding notes.

; -------------------------------------------------------------------------------------

Each chapter starts with some narrative. This is stored as compressed nametables.
Fixed-length 16-bit data. Worse, the game uses translation lookup tables. Meaning $0020
could equal FOUR NT VALUES to create a 16x16 window corner. There's no scripting
format to help out here.

The printing routine also uses a wide cursor. So 1 bump = 16 pixels width. And height.


Flow:
- Decode nametable (ENIGMA)
- Decode mapping table (ENIGMA)
- Add -OFFSET- values to mapping table to match VRAM location (local->world coordinates)
- Run through nametable (fixed-length)
  - Grab map #
  - Use table to find final NT #s
  - Write 4 8x8 NTs (upper / lower)
  - Bump xpos by 1 (16 pixels)


Strategy:
- Treat each line as its own seperate string (see script).
- Atlas will write a 16-bit 'index #' (LSB) to the starting location of each text area
  in the compressed tilemap files.

- Change $12F9A to check for the SPECIAL INDEX range ($8000-8200) when the code is read.
  - $0000-7FFF ==> run the normal lookup table routine which will draw the
    windows and portraits "as-is" in 16x16 mode.

  - $8000-81FF ==> run our own custom text routine. It will load the ptr-32 table
    at $80000. Then build the tiles in vram from here - VWF or half-width. Update the
    vram nametable for this line. Then bump the cursor to the end-of-string area, which
    is the right window border or 11*2 text tiles away.

- Keep running as normal, as the engine will take care of itself.

This is awkward but a reasonable way to handle the problem.


; retrieve 16-bit index code (LSB)
moveq #0x00,d1
move.b 0x0001(a3),d1
lsl.l #8,d1
move.b 0x0000(a3),d1

; -------------------------------------------------------------------------------------

In-game dialogue windows behave almost the same way as the story text. Only the box
dimensions are smaller.

; -------------------------------------------------------------------------------------

The chapter screens (x4) use an offset decoder (tile #s are local but the Enigma
algorithm bumps them by +1 ~ $20 vram). The full NT lines are stored and transferred
to VRAM immediately.

The 16x16 tiles are dumped in 8x8-style for easier translation but re-insertion will
be up to you.

; -------------------------------------------------------------------------------------

Some notes on VRAM writing.

When the VDP gun is on, you can write to VRAM safely. A buffer will fill but it has
limited space, competing with the screen rastering. When it overflows, the gun turns off.
So don't flood it too hard during active display.

; ============================================================================
; ############################################################################
; ============================================================================

Atlas 1.06 is modified (nothing new since 'Super Robot Wars EX')

> #FILL( int stop_address, int file_byte )		- pads up to stop address
  #FILL( int start, stop, int file_byte )		- pads address range
  #FILL( int start, stop, int file_byte, string file )	- pads address range IN FILE

  #WARN( int warn_address )				- OKAY/BARF if PC counter >= warn_address

  #SAVEPC( string file_name )				- writes PC to file
  #LOADPC( string file_name )				- loads PC from file

  #INSERT( string file_name )				- inserts binary file at current PC

  MSB16,MSB24,MSB32,GB4xxx				- addressing modes

  #SETINDEX( int index_number, int size )		- init the index numbers
  #WRITEINDEX( int address, int index_bump )		- writes index numbers to address, # bytes
							  and auto-bumps the index #
  #WRITEINDEX( int addr, int index_bump, string file )	- writes index number to address IN FILE

  #SAVEINDEX( string file_name )			- writes INDEX # to file
  #LOADINDEX( string file_name )			- loads INDEX # from file

  #ALIGN( int byte_count )                      	- does file alignment (1,2,3,4)

  #W08BYTE( int address, int byte )			- writes byte to address (no JMP)
  #W08BYTE( int addr, int byte, string file )		- writes byte to address IN FILE (no JMP)

  #EMBCLEAR()						- erases all embedded pointers

  #SAVEPTRTABLE( PTRTABLE table, string file_name )	- writes PTRTABLE address to file
  #LOADPTRTABLE( PTRTABLE table, string file_name )	- loads PTRTABLE address from file 

  #WRITEOFS( PTRTABLE table, int offset )		- writes POINTER at an offset amount (from the table start)
